package com.ilaber.beehive.ui;

import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;

public class ImageProcessing extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5609649206759553554L;
	String filepath = "";
	String filename = "";
	File file2;
	BufferedImage buffimg = null;
	ImageIcon ic;
	Image ia, l;
	JLabel jLabel1 = null;
	BorderLayout borderLayout1 = new BorderLayout();
	JMenuBar jmb = new JMenuBar();
	JMenu file, edit, view, caijian, suofang, gray, see, save, move, niuqu;

	public ImageProcessing(String title) {
		super(title);
		file = new JMenu(" 文件 ");
		JMenuItem dakai = new JMenuItem(" 打开 ");
//		dakai.addActionListener(new dakai_actionAdapter(this));
		file.add(dakai);
		file.addSeparator();
		JMenuItem tuichu = new JMenuItem(" 退出 ");
//		tuichu.addActionListener(new tuichu_actionAdapter(this));
		file.add(tuichu);
		jmb.add(file);

		caijian = new JMenu(" 裁剪 ");
		JMenuItem fangxingcaijian = new JMenuItem(" 方形裁剪 ");
//		fangxingcaijian.addActionListener(new testImage_fangxingcaijian_actionAdapter(this));
		this.getContentPane().setLayout(borderLayout1);
		caijian.add(fangxingcaijian);
		caijian.addSeparator();
//		JMenuItem juxingcaijian = new JMenuItem(" 矩形裁剪 ");
//		juxingcaijian.addActionListener(new testImage_fangxingcaijian_actionAdapter(this));
//		this.getContentPane().setLayout(borderLayout1);
//		caijian.add(juxingcaijian);
		jmb.add(caijian);

		suofang = new JMenu(" 缩放 ");
		JMenuItem suoxiao = new JMenuItem(" 缩小 ");
//		suoxiao.addActionListener(new testImage_suoxiao_actionAdapter(this));
		this.getContentPane().setLayout(borderLayout1);
		suofang.add(suoxiao);
		suofang.addSeparator();
		JMenuItem fangda = new JMenuItem(" 放大 ");
//		fangda.addActionListener(new testImage_fangda_actionAdapter(this));
		suofang.add(fangda);
		jmb.add(suofang);

		edit = new JMenu(" 旋转 ");
		JMenuItem xuanzhuan90 = new JMenuItem(" 旋转 90 度（顺时针）");
//		xuanzhuan90.addActionListener(new xuanzhuan90_actionAdapter(this));
		edit.add(xuanzhuan90);
		edit.addSeparator();
		JMenuItem xuanzhuan180 = new JMenuItem(" 旋转 180 度 （顺时针）");
//		xuanzhuan180.addActionListener(new xuanzhuan180_actionAdapter(this));
		edit.add(xuanzhuan180);
		edit.addSeparator();
		JMenuItem xuanzhuanziyou = new JMenuItem(" 旋转 270度（顺时针）");
//		xuanzhuanziyou.addActionListener(new xuanzhuanziyou_actionAdapter(this));
		edit.add(xuanzhuanziyou);
		edit.addSeparator();
		JMenuItem xuanzhuan270 = new JMenuItem(" 自由旋转角度 ");
//		xuanzhuan270.addActionListener(new xuanzhuan270_actionAdapter(this));
		edit.add(xuanzhuan270);
		jmb.add(edit);
		gray = new JMenu(" 图像灰度处理 ");
		JMenuItem huidu = new JMenuItem(" 灰度变换 ");
//		huidu.addActionListener(new huidu_actionAdapter(this));
		gray.add(huidu);
		gray.addSeparator();
		JMenuItem junhenghua = new JMenuItem(" 直方图均衡化 ");
//		junhenghua.addActionListener(new junhenghua_actionAdapter(this));
		gray.add(junhenghua);
		jmb.add(gray);
		// zyf/
		see = new JMenu(" 变形 ");
		JMenuItem lashen = new JMenuItem(" 拉伸 ");
//		lashen.addActionListener(new testImage_lashen_actionAdapter(this));
		see.add(lashen);
		see.addSeparator();
		JMenuItem zhankuan = new JMenuItem(" 展宽 ");
//		zhankuan.addActionListener(new testImage_zhankuan_actionAdapter(this));
		see.add(zhankuan);
		see.addSeparator();
		jmb.add(see);
		niuqu = new JMenu(" 扭曲 ");
		JMenuItem niuqu1 = new JMenuItem(" 扭曲 ");
//		niuqu1.addActionListener(new testImage_niuqu1_actionAdapter(this));
		niuqu.add(niuqu1);
		niuqu.addSeparator();
		jmb.add(niuqu);
		save = new JMenu(" 保存 ");
		JMenuItem saveas = new JMenuItem(" 另存为 ");
//		saveas.addActionListener(new saveas_actionAdapter(this));
		save.add(saveas);
		save.addSeparator();
		jmb.add(save);
		move = new JMenu(" 移动 ");
		JMenuItem lmove = new JMenuItem(" 向左移动 ");
//		lmove.addActionListener(new lmove_actionAdapter(this));
		move.add(lmove);
		move.addSeparator();

		JMenuItem rmove = new JMenuItem(" 向右移动 ");
//		rmove.addActionListener(new rmove_actionAdapter(this));
		move.add(rmove);
		move.addSeparator();
		JMenuItem cmove = new JMenuItem(" 居中移动 ");
//		cmove.addActionListener(new cmove_actionAdapter(this));
		move.add(cmove);
		move.addSeparator();
		JMenuItem umove = new JMenuItem(" 向上移动 ");
//		umove.addActionListener(new umove_actionAdapter(this));
		move.add(umove);
		move.addSeparator();
		JMenuItem dmove = new JMenuItem(" 向下移动 ");
//		dmove.addActionListener(new dmove_actionAdapter(this));
		move.add(dmove);
		move.addSeparator();
		jmb.add(move);
		// zyf/
		view = new JMenu(" 详情 ");
		JMenuItem banben = new JMenuItem(" 版本说明 ");
//		banben.addActionListener(new banben_actionAdapter(this));
		view.add(banben);
		jmb.add(view);
		// zyf
		this.setSize(1024, 800);
		this.setJMenuBar(jmb);
		jLabel1 = new JLabel("", JLabel.CENTER);
		JScrollPane pane = new JScrollPane(jLabel1);
		this.add(pane, borderLayout1.CENTER);
		this.setVisible(true);
		//设置窗口居中
		this.setLocationRelativeTo(null);
	}

	public static void main(String[] args) {
		ImageProcessing testImage1 = new ImageProcessing("蜂巢巢穴数计算");
		testImage1.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}
}
